<script type="text/javascript" src="../../repo/files/%3Apublic%3Aplugin-samples%3Apentaho-cdf%3A30-documentation%3A30-component_reference%3Asamples.js"></script>
<div class="shadow">

  <div class="contents">

    <h2>ExecuteXactionComponent</h2>

    <h3>Description</h3>
    <p>
    Executes a Action Sequence and displays the result on a new pop-up window.
    </p>

    <h3>Options</h3>

    <dl class="documentation">
      <dt>name</dt>
      <dd>The name of the component</dd>

      <dt>type</dt>
      <dd><code>executeXaction</code></dd>

      <dt>listeners</dt>
      <dd><i>Array - </i> Parameters who this component will react to</dd>

      <dt>parameters</dt>
      <dd><i>Array of Arrays - </i> Parameters to pass to the xaction</dd>

      <dt>solution</dt>
      <dd>Solution where the xaction is</dd>

      <dt>path</dt>
      <dd>Path where the xaction file is</dd>

      <dt>action</dt>
      <dd>Xaction file name</dd>

      <dt>htmlObject</dt>
      <dd>Id of the component (usually a div or a span tag) to be replaced by the result. It can point to a button or link</dd>

      <dt>refreshPeriod</dt>
      <dd>Time in seconds for this component to refresh. Default is 0 (disabled)</dd>

      <dt>label</dt>
      <dd>Text to be used on the generated button (only used if htmlObject points to a div/span)</dd>

      <dt>executeAtStart</dt>
      <dd>True to execute the component at start, false otherwise</dd>

      <dt>tooltip</dt>
      <dd>Tooltip to be displayed when mouse hovers</dd>

      <dt>preExecution</dt>
      <dd><i>Function - </i> Function to be called before the component is executed</dd>

      <dt>postExecution</dt>
      <dd><i>Function - </i> Function to be called after the component is executed</dd>

      <dt>preChange</dt>
      <dd><i>Function - </i> Function to be called before the xaction is executed. The xaction will be executed only if the result of preChange equals true.</dd>

      <dt>postChange</dt>
      <dd><i>Function - </i> Function to be called after the xaction is executed</dd>

    </dl>

    <h3>Sample</h3>

    <div id="example" class="flora">
      <ul>
        <li><a href="#sample"><span>Sample</span></a></li>
        <li><a href="#code"><span>Code</span></a></li>
      </ul>
      <div id="sample">
        <div id="sampleObject"></div>
        <br/>
      </div>

      <div id="code">
        <textarea cols="80" rows="40" id="samplecode">
require([
  'cdf/Dashboard.Blueprint',
  'cdf/components/ExecuteXactionComponent'
], function(Dashboard, ExecuteXactionComponent) {

  var dashboard = new Dashboard();
  dashboard.addParameter("productLineParam", "null");
  dashboard.addParameter("territoryParam", "null");

  dashboard.addComponent(new ExecuteXactionComponent({
    name: "executeTopTenCustomers",
    type: "executeXaction",
    path: "/public/plugin-samples/pentaho-cdf/20-samples/home_dashboard/topTenCustomers.xaction",
    listeners: ["productLineParam", "territoryParam"],
    parameters: [["productLine", "productLineParam"], ["territory", "territoryParam"]],
    htmlObject: "sampleObject",
    label: "Execute XAction",
    executeAtStart: true,
    preChange: function() { return true; },
    postChange: function() { return true; },
    tooltip: "My first dashboard"
  }));
  dashboard.init();
});
        </textarea>
        <br/>
        <button id="tryMe">Try me</button>
      </div>
    </div>
  </div>
</div>